#include "game.h"
#include "ui_game.h"
#include "card.h"
#include "qobject.h"


Game::Game(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Game)
{
    ui->setupUi(this);

}

Game::~Game()
{
    delete ui;
}


double randomplace()
{
    return QRandomGenerator::global()->bounded(500.00);
}

double randomtime()
{
    return QRandomGenerator::global()->bounded(5.00);
}

void Game::paintEvent(QPaintEvent *ev)
{
    static int pos=0;
    QString pictures[2]={":/res/tabletop.png",""};
    QPainter *painter =new QPainter(this);
    QPainter *painter2 =new QPainter(this);

    QPixmap pixmap;
    pixmap.load(pictures[pos]);
    pixmap.scaled(512,512);
    painter->drawPixmap(0,0,512,512,pixmap);

    QPixmap pixcard;
    pixcard.load(":/res/CardBack.png");
    painter2->drawPixmap(randomplace(),randomplace(),100,150,pixcard);
}


